//用户信息
var userInfo = {
	head_img: "https://front.mybmall.com/image/cbd.jpg",
	time: "30周2天",
}
// 最近7天
var wData = {
	y_name: "公斤(kg)",
	x_name: "第/周", //最近30天，孕期
	y_min: 0,
	y_max: 120,
	label_show: true, //数值标签
	w_data: [40, 45, 48, '-', '-', 60, 65], //体重值
	x_data: ['1.1', '1.2', '1.3', '1.4', '1.5', '1.6', '1.7'], //x轴
	min_data: [30, 32, 35, 38, 40, 45, 50], //下线数据，
	max_data: [60, 65, 70, 75, 80, 85, 90], //上线数据
	label_name: "体重", //体脂/估重
	legend: {
		min: "最低",
		weight: "体重",
		max: "最高",
	},
	interval: 0, //x_轴间隔
};

//最近30天
var mData = {
	y_name: "公斤(kg)",
	x_name: "最近30天", //最近30天，孕期
	y_min: 0,
	y_max: 120,
	label_show: false, //数值标签
	w_data: [40, 45, 48, 50, 56, 60, 65, 65, 68, 70,
		40, 45, 48, 50, 56, 60, 65, 65, 68, 70,
		40, 45, 48, 50, 56, 60, 65, 65, 68, 70
	], //体重值
	x_data: ['1月1日', '1.2', '1.3', '1.4', '1.5', '1.6', '1.7', '1.8', '1.9', '1.10',
		'1.11', '1.12', '1.13', '1.14', '1.15', '1.16', '1.17', '1.18', '1.19', '1.20',
		'1.21', '1.22', '1.23', '1.24', '1.25', '1.26', '1.27', '1.28', '1.29', '1.30'
	], //x轴
	min_data: [30, 32, 35, 38, 40, 45, 50, 60, 50, 55,
		30, 32, 35, 38, 40, 45, 50, 60, 50, 55,
		30, 32, 35, 38, 40, 45, 50, 60, 50, 55
	], //下线数据，
	max_data: [60, 65, 70, 75, 80, 85, 90, 90, 95, 100,
		60, 65, 70, 75, 80, 85, 90, 90, 95, 100,
		60, 65, 70, 75, 80, 85, 90, 90, 95, 100
	], //上线数据
	label_name: "体重", //体脂/估重
	legend: {
		min: "最低",
		weight: "体重",
		max: "最高",
	},
	interval: 3, //x_轴间隔
};

//全孕期  已周为单位  每周为一个点 ，全部 输出
var yData = {
	y_name: "公斤(kg)",
	x_name: "孕期(40周)", //最近30天，孕期
	y_min: 0,
	y_max: 120,
	label_show: false, //数值标签
	w_data: [40, 45, 48, 50, 56, 60, 65, 65, 68, 70,
		40, 45, 48, 50, 56, 60, 65, 65, 68, 70,
		40, 45, 48, 50, 56, 60, 65, 65, 68, 70,
		40, 45, 48, 50, 56, 60, 65, 65, 68, 70,
	], //体重值
	x_data: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
		"11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
		"21", "22", "23", "24", "25", "26", "27", "28", "29", "30",
		"31", "32", "33", "34", "35", "36", "37", "38", "39", "40",
	], //x轴
	min_data: [30, 32, 35, 38, 40, 45, 50, 60, 50, 55,
		30, 32, 35, 38, 40, 45, 50, 60, 50, 55,
		30, 32, 35, 38, 40, 45, 50, 60, 50, 55,
		30, 32, 35, 38, 40, 45, 50, 60, 50, 55
	], //下线数据，
	max_data: [60, 65, 70, 75, 80, 85, 90, 90, 95, 100,
		60, 65, 70, 75, 80, 85, 90, 90, 95, 100,
		60, 65, 70, 75, 80, 85, 90, 90, 95, 100,
		60, 65, 70, 75, 80, 85, 90, 90, 95, 100
	], //上线数据
	label_name: "体重", //体脂/估重
	legend: {
		min: "最低",
		weight: "体重",
		max: "最高",
	},
	interval: 38, //x_轴间隔
};

var week_date = ["第一周", "第一周", "第一周", "第一周", "第一周", "第一周"];
var month_date = [];

$(function () {
	var w_weight = document.getElementById('w_weight'); //体重

	//用户信息
	$("#headImg").attr('src', userInfo.head_img);
	$("#headName").html(userInfo.time);
	console.log(echart(w_weight, wData));
	//切换 tabbar
	//	mui("#segmentedControl").on('tap', "a", function() {
	//		$(".mian").width($(".mui-table-view-cell").width());
	//	})
	document.getElementById("mySwitch").addEventListener("toggle", function (event) {
		if (event.detail.isActive === true) {
			console.log(event.detail.isActive)
		} else {
			console.log(event.detail.isActive)
		}
	})

})

function cheakItem(e) {
	var es = $(e)
	var id = Number(es.attr("id")) + 1;
	console.log("时间id" + id);
}

// 获取url参数
function geTurl(name) {
	var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
	var r = window.location.search.substr(1).match(reg);
	if (r != null) return decodeURI(r[2]);
	return null;
}